package cn.lixu.controller;

import cn.lixu.domain.Users;
import com.alibaba.csp.sentinel.annotation.SentinelResource;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ProjectName: springcloud-alibaba-parent-homework
 * @Package: cn.lixu.controller
 * @ClassName: GateWayController
 * @Author: LIXU
 * @Description: 描述该类的作用
 * @Date: 2022/08/25 0025 0:28:43
 * @Version: 1.0
 **/
@RestController
@RequestMapping("/gateway")
public class GateWayController {

    @GetMapping("/getById/{id}")
    @SentinelResource(value = "gateway-server", blockHandler = "gateWayBlock")
    public Users getById(@PathVariable("id") Long id) {
        return new Users(id, "罗顶天", "不男不女");
    }


    public Users gateWayBlock(@PathVariable("id") Long id) {
        return new Users(-1L, "罗顶天你是不是傻逼", "你还要点是不是？");
    }

}
